using System.Linq;
using System.Runtime.Serialization;

namespace Director.DomainModels
{
	[DataContract]
	public class Security : Identifiable
	{
		[DataMember]
		public int Decimals { get; set; }

		[DataMember]
		public int Lotsize { get; set; }

		[DataMember]
		public int MarketId { get; set; }

		[DataMember]
		public SecurityTypes Sectype { get; set; }

		[DataMember]
		public string Code { get; set; }

		[DataMember]
		public string Board { get; set; }

		public override string ToString()
		{
			return Sectype +" " + Code + " " + Name + " " + Lotsize;
		}

		public Market Market
		{
			get { return DataManager.Instance.Markets.First(e => e.Id == MarketId); }
		}

		public Board BoardObj
		{
			get { return DataManager.Instance.Boards.First(e => e.Id == Board); }
		}

		public string Info
		{
			get { return "SecId = " + Id; }
		}
	}
}